package com.example.shardingjdbc.service;

import com.example.shardingjdbc.mapper.UserMapper;
import com.example.shardingjdbc.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.stream.IntStream;

@Service
public class UserServiceImpl {
    @Autowired
    UserMapper userMapper;

    public void addUser(){
        IntStream.range(0,10).forEach(i->{
            UserModel userModel = new UserModel("test", i+100l, String.valueOf(i));
            userMapper.insert(userModel);
        });
    }
}
